﻿Imports System.Windows.Forms

Public Class TabContextMenu
    Inherits ContextMenuStrip

    Private _editortabmanager As EditorTabManager
    Public Sub New(ByRef editortabmanager As EditorTabManager)
        _editortabmanager = editortabmanager
        Me.Items.Add("Close", Nothing, AddressOf CloseButton_Click)
        Me.Items.Add("Close Others", Nothing, AddressOf CloseOthersButton_Click)
        Me.Items.Add("Close All", Nothing, AddressOf CloseAllButton_Click)
        Me.Items.Add("-")
        Me.Items.Add("Open Path", Nothing, AddressOf OpenPathButton_Click)
        Me.Items.Add("Open Editor", Nothing, AddressOf OpenEditorButton_Click)
    End Sub

    Private Sub CloseButton_Click(ByVal sender As Object, ByVal e As EventArgs)
        _editortabmanager.CloseTab(_editortabmanager.TabClicked)
    End Sub

    Private Sub CloseOthersButton_Click(ByVal sender As Object, ByVal e As EventArgs)
        _editortabmanager.CloseOthers(_editortabmanager.TabClicked)
    End Sub

    Private Sub OpenPathButton_Click(ByVal sender As Object, ByVal e As EventArgs)
        _editortabmanager.SelectedTabProjectFile.OpenPath()
    End Sub

    Private Sub OpenEditorButton_Click(ByVal sender As Object, ByVal e As EventArgs)
        _editortabmanager.SelectedTabProjectFile.OpenEditor()
    End Sub

    Private Sub CloseAllButton_Click(ByVal sender As Object, ByVal e As EventArgs)
        _editortabmanager.CloseAll()
    End Sub

End Class
